package com.winter.service.impl;
import com.github.pagehelper.PageHelper;
import com.winter.mapper.CategoryMapper;
import com.winter.model.Category;
import com.winter.model.CategoryExample;
import com.winter.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;

    @Override
    public void insertCategory(Category category) {
        System.out.println(category);
        categoryMapper.insert(category);
    }

    @Override
    public List<Category> queryAll(int pageNum,int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return categoryMapper.selectByExample(new CategoryExample());
    }

    @Override
    public Category queryOne(String id) {
        return categoryMapper.selectByPrimaryKey(id);
    }
}
